﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Engine.Sgml.Allocation {
    internal sealed class SiblingsIterator : INodeIterator {
        private SElement current;

        public SElement Current {
            get { return current; }
            }

        public bool MoveNext() {
            if (current == null)
                return false;
            current = current.NextNonCommentNode();
            return current != null;
            }

        public bool MovePrevious() {
            if (current == null)
                return false;
            current = current.PreviousNonCommentNode();
            return current != null;
            }

        public void Reset(SElement element) {
            Guard.ArgumentNotNull(element, "element");
            current = element;
            }
        }
    }
